package com.gouaixin.bee.beeframework2.bean;

import com.gouaixin.bee.beeframework2.MyAPI;
import com.gouaixin.bee.beeframework2.tool.XHttpUtils;
import com.gouaixin.bee.beeframework2.tool.mLog;
import com.lidroid.xutils.HttpUtils;
import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.RequestParams;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;
import com.lidroid.xutils.http.client.HttpRequest;

/**
 * Created by Administrator on 2015/4/1.
 */
public class guanzhuModel extends BaseModel {




    private static void addguanzhu(String id, String cid) {
         mTAG = "addguanzhu";

        final String url = MyAPI.addguanzhu;
        mLog.e(mTAG + "： url=" + url);
        final String[] result = {""};

        RequestParams params = new RequestParams();
        params.addBodyParameter("id", id);
        params.addBodyParameter("cid", cid);

        HttpUtils http = new HttpUtils();
        http.send(HttpRequest.HttpMethod.POST,
                url,
                params,
                new RequestCallBack<String>() {
                    @Override
                    public void onSuccess(ResponseInfo<String> responseInfo) {
                        mLog.e(mTAG + "：响应=" + XHttpUtils.Unicode2Chinese(responseInfo.result));
                        result[0] = XHttpUtils.Unicode2Chinese(responseInfo.result);
                        mCallBackLister.onCallBack(url, result[0]);

                    }

                    @Override
                    public void onFailure(HttpException error, String msg) {
                        mLog.e("请求故障：" + msg);
                    }
                }
        );

    }



    private static void getguanzhulist(String p, String cid) {
        mTAG = "getguanzhulist";

        final String url = MyAPI.getguanzhulist;
        mLog.e(mTAG + "： url=" + url);
        final String[] result = {""};

        RequestParams params = new RequestParams();
        params.addBodyParameter("p", p);
        params.addBodyParameter("cid", cid);

        HttpUtils http = new HttpUtils();
        http.send(HttpRequest.HttpMethod.POST,
                url,
                params,
                new RequestCallBack<String>() {
                    @Override
                    public void onSuccess(ResponseInfo<String> responseInfo) {
                        mLog.e(mTAG + "：响应=" + XHttpUtils.Unicode2Chinese(responseInfo.result));
                        result[0] = XHttpUtils.Unicode2Chinese(responseInfo.result);
                        mCallBackLister.onCallBack(url, result[0]);
                    }

                    @Override
                    public void onFailure(HttpException error, String msg) {
                        mLog.e("请求故障：" + msg);
                    }
                }
        );
    }



}
